package com.free.mini.admin.controller;

import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.free.mini.common.base.ResultData;
import com.free.mini.core.server.api.AdminUserApi;
import com.free.mini.core.server.vo.req.AdminUserLoginReqVO;
import com.free.mini.core.server.vo.req.AdminUserQueryDetailReqVO;
import com.free.mini.core.server.vo.req.AdminUserRegisterReqVO;
import com.free.mini.core.server.vo.resp.AdminUserLoginRespVO;
import com.free.mini.core.server.vo.resp.AdminUserQueryDetailRespVO;

import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;

/**
 * @author dongsufeng
 * @version 4.0
 * @date 2023/8/19 09:36
 */
@RestController
@Slf4j
@RequiredArgsConstructor
@RequestMapping("api/admin/user/v1/")
public class AdminUserController {

    private final AdminUserApi adminUserApi;

    @PostMapping("register")
    public ResultData register(@RequestBody @Validated AdminUserRegisterReqVO reqVO){
        return adminUserApi.register(reqVO);
    }

    @PostMapping("login")
    public ResultData<AdminUserLoginRespVO> login(@RequestBody @Validated AdminUserLoginReqVO reqVO){
        return adminUserApi.login(reqVO);
    }
    @PostMapping("detail")
    public ResultData<AdminUserQueryDetailRespVO> detail(@RequestBody @Validated AdminUserQueryDetailReqVO reqVO){
        return adminUserApi.detail(reqVO);
    }
}
